import request from "@/utils/request";
export function policy(data) {
  return request({
    url: "/web/common/upload",
    method: "post",
    data: data,
  });
}
export function cropUpload(data) {
  return request({
    url: "/cms/oss/cropUpload",
    method: "post",
    data: data,
  });
}

/**
 * 生成随机文件名称
 * 规则八位随机字符，加下划线连接时间戳
 */
export const getFileNameUUID = () => {
  function rx() {
    return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
  }
  return `${+new Date()}_${rx()}${rx()}`;
};
